// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


#if USE_SDATA || USE_USERDATA
using System;
using Mios.Generated.DeviceFiles;

namespace Mios.Generated
{
    // MiosDeviceCreator : Create MiosDevice instance with provided DeviceType
    
    public static class MiosDeviceCreator
    {
        #region Method Create(MiosEngine engine, UInt32 id, String name, String localUdn, String deviceType, MiosRoom room) : MiosDevice;
        public static MiosDevice Create(MiosEngine engine, UInt32 id, String name, String localUdn, String deviceType, MiosRoom room)
        {
            if (engine == null)
                throw new ArgumentNullException("engine");
            
            if (String.IsNullOrEmpty(deviceType))
                throw new ArgumentNullException("deviceType");
            
            if (room == null)
                throw new ArgumentNullException("room");
            
            if(String.IsNullOrEmpty(name))
                name = String.Format("Unnamed Device {0}", id);
            
            switch(deviceType)
            {
                case "urn:schemas-micasaverde-com:device:avmisc:1":
                    return new AvMisc1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:BinaryLight:1":
                    return new BinaryLight1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:ComboDevice:1":
                    return new ComboDevice1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:DigitalSecurityCamera:1":
                    return new DigitalSecurityCamera1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:DigitalSecurityCamera:2":
                    return new DigitalSecurityCamera2(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:DimmableLight:1":
                    return new DimmableLight1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:DoorLock:1":
                    return new DoorLock1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:DoorSensor:1":
                    return new DoorSensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:EnergyCalculator:1":
                    return new EnergyCalculator1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:GenericIO:1":
                    return new GenericIO1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:GenericSensor:1":
                    return new GenericSensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:Heater:1":
                    return new Heater1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:HumiditySensor:1":
                    return new HumiditySensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:HVAC_ZoneThermostat:1":
                    return new HVAC_ZoneThermostat1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:InsteonNetwork:1":
                    return new InsteonNetwork(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:IrDevice:1":
                    return new IrDevice1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:IrTransmitter:1":
                    return new IrTransmitter1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:Keypad:1":
                    return new Keypad1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:LightSensor:1":
                    return new LightSensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:MotionSensor:1":
                    return new MotionSensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:PowerMeter:1":
                    return new PowerMeter1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:Relay:1":
                    return new Relay1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:RemoteControl:1":
                    return new RemoteControl1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:Scene:1":
                    return new Scene1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:SceneController:1":
                    return new SceneController1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:SceneControllerLED:1":
                    return new SceneControllerLED1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:micasaverde-org:device:SerialPort:1":
                    return new SerialPort1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:micasaverde-org:device:SerialPortRoot:1":
                    return new SerialPortRoot1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:Siren:1":
                    return new Siren1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:SmokeSensor:1":
                    return new SmokeSensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:SmtpNotification:1":
                    return new SmtpNotification(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:TemperatureSensor:1":
                    return new TemperatureSensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:TempLeakSensor:1":
                    return new TempLeakSensor1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:USBUIRT:1":
                    return new USB_UIRT(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:VistaAlarmPanel:1":
                    return new VistaAlarmPanel1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:VistaAlarmPartition:2":
                    return new VistaAlarmPartition1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-upnp-org:device:VSwitch:1":
                    return new VSwitch(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:WindowCovering:1":
                    return new WindowCovering1(engine, id, name, localUdn, deviceType, room);
                
                case "urn:schemas-micasaverde-com:device:ZWaveNetwork:1":
                    return new ZWaveNetwork(engine, id, name, localUdn, deviceType, room);
                
                default:
                    return new MiosDevice(engine, id, name, localUdn, deviceType, room);
            }
        }
        #endregion Method Create
        
    } //End of class
} //End of Namespace
#endif

